package com.yyyzzz.service.impl;

import com.yyyzzz.DAO.impl.teacherDaoimpl;
import com.yyyzzz.DAO.teacherDao;
import com.yyyzzz.bean.Teacher;
import com.yyyzzz.service.teacherService;

import java.sql.SQLException;
import java.util.List;

public class teacherServiceImpl implements teacherService {

    @Override
    public boolean checktracher (int teacherNo , String teacherpassword) throws SQLException, ClassNotFoundException {
        teacherDaoimpl teacherDaoimpl = new teacherDaoimpl ();
        Teacher teacher = teacherDaoimpl.getTeacherById (teacherNo);
        if ( teacher == null ){
            System.out.println ("没有这个人");
            return false;
        }else if (teacher.getTeacherpassword ().equals (teacherpassword) ){
            return true;
        }
        return false;
        }

    @Override
    public boolean modifyTeacher (Teacher teacher) throws Exception {
        teacherDao teacherDaoimpl = new teacherDaoimpl ();
        int i = teacherDaoimpl.modifyTeacher (teacher);
        if ( i>0 ){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List selectCourseTeacher (String name) throws Exception {
        teacherDao teacherDaoimpl = new teacherDaoimpl ();
        List list = teacherDaoimpl.getList (name);
        return list;
    }
}

